package sdk

import (
	"context"
)

// Client 提供统一的 SDK 客户端接口
type Client struct {
	apiClient  *APIClient
	system     *SystemClient
	connection *ConnectionClient
	domain     *DomainClient
	network    *NetworkClient
	storage    *StorageClient
	console    *ConsoleClient
}

// NewClient 创建新的 SDK 客户端
func NewClient(baseURL string) *Client {
	apiClient := NewAPIClient(baseURL)

	return &Client{
		apiClient:  apiClient,
		system:     NewSystemClient(apiClient),
		connection: NewConnectionClient(apiClient),
		domain:     NewDomainClient(apiClient),
		network:    NewNetworkClient(apiClient),
		storage:    NewStorageClient(apiClient),
		console:    NewConsoleClient(apiClient),
	}
}

// System 返回系统管理客户端
func (c *Client) System() *SystemClient {
	return c.system
}

// Connection 返回连接管理客户端
func (c *Client) Connection() *ConnectionClient {
	return c.connection
}

// Domain 返回虚拟机管理客户端
func (c *Client) Domain() *DomainClient {
	return c.domain
}

// Network 返回网络管理客户端
func (c *Client) Network() *NetworkClient {
	return c.network
}

// Storage 返回存储管理客户端
func (c *Client) Storage() *StorageClient {
	return c.storage
}

// Console 返回控制台管理客户端
func (c *Client) Console() *ConsoleClient {
	return c.console
}

// GetServerURL 返回服务器 URL
func (c *Client) GetServerURL() string {
	return c.apiClient.GetServerURL()
}

// HealthCheck 执行健康检查
func (c *Client) HealthCheck(ctx context.Context) error {
	return c.system.HealthCheck(ctx)
}
